﻿using Coomtools.commclass;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CYLScheck.UIcomm
{
  /// <summary>
  /// 获得硬件信息类
  /// </summary>
    public class GetHarewareInfo
    {
     /// <summary>
     /// 获得硬件信息方法
     /// </summary>
     /// <returns></returns>
      public bool Gegharwareinfo()
        {
            try
            {
            HardwareInfo hardwareinfo = new HardwareInfo();
            GobleSysInfo.CPUID = hardwareinfo.GetCpuID();
            GobleSysInfo.ComputeName = hardwareinfo.GetComputerName();
            GobleSysInfo.DiskHardNumber = hardwareinfo.GetFristHardDiskID();
             GobleSysInfo.SysType = hardwareinfo.GetSystemType();
                string PhysicalMemory = hardwareinfo.GetTotalPhysicalMemory();
              //内存数转化为G 单位
                double dpm = Convert.ToDouble( PhysicalMemory ) / 1068900000;
                GobleSysInfo.PPhysicalMemory = dpm.ToString("#.##") + "(G byte)";
              GobleSysInfo.MacAdress = hardwareinfo.GetPhysicLocalMacAddr();  
            //获得物理网卡ip地址列表
               List<string> iplist = new List<string>();  
                iplist=hardwareinfo.GetPhysicMacAdressList();
                foreach (var item in iplist)
                {
                    GobleSysInfo.IPAdress= GobleSysInfo.IPAdress+item+" || ";
                }

                return true;
           
            }
            catch (Exception )
            {
                
                
              return false;   
               
            }
            
      

        }
            
            
            }
}
